package sctu.edu.java.year2016.team01.xuhanmei.day20160524.practice4;

/**
 * Created by Administrator on 2016/5/24.
 */
public class DeleteSame {
    public static void main(String[] args) {
        String s = "命运如同海风一样，如同飘摇的舟，如同领航的帆";


        StringBuilder sd = new StringBuilder(s);


        System.out.println("原来的字符串是：" + sd);
        System.out.println("原来的字符串长度是：" + sd.length());


        for (int i = 0; i < sd.length(); i++) {
            for (int j = i + 1; j < sd.length(); j++) {
                if (sd.charAt(i) == sd.charAt(j)) {
                    sd.deleteCharAt(j);
                }
            }
        }
        System.out.println("现在的字符串是：" + sd);
        System.out.println("现在的字符串长度是：" + sd.length());
    }
}
